﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;

namespace Lolitemchanger
{
    class CGestionZip
    {
        public void Zip(string SrcFile, string DstFile, string Character)
        {
            string path = SrcFile + @"\" + Character + @"\" + Character + ".inibin";
            FileStream stream = new FileStream(DstFile, FileMode.Open, FileAccess.ReadWrite);
            ZipFile z = new ZipFile(stream);
            z.BeginUpdate();
            z.Add(path, @"DATA\Characters\" + Character + @"\" + Path.GetFileName(path));
            z.CommitUpdate();
            while (z.IsUpdating)
            {
            }
            stream.Close();
            
        }

        public void UnZip(string SrcFile, string DstFile, string Character)
        {
            FastZip zip = new FastZip();
            zip.ExtractZip(SrcFile, DstFile, FastZip.Overwrite.Always, null, Character + ".inibin", Character, false);
        }
    }
}
